package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.query.NewsQueryObject;
import cn.wolfcode.trip.base.service.INewsService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("news")
public class NewsController {

    @Autowired
    private INewsService newsService;

    /**
     * 获取所有的日报
     * @return
     */
    @RequestMapping(method = RequestMethod.GET)
    public PageInfo query(NewsQueryObject qo){
        qo.setOrderBy("releaseTime desc");
        qo.setState(2);
        return newsService.queryForlist(qo);
    }

}
